package znbkBkfx.BkfxResultAnalysis;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.text.Html;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.znbk.znbklibrary.base.BaseLongActivity;
import com.example.znbk.znbklibrary.util.LancooUtils;
import com.example.znbk.znbklibrary.widget.ScaleButton;
import com.lancoo.znbkxx.MainActivity;
import com.lancoo.znbkxx.R;
import com.lancoo.znbkxx.beans.UserInfoBean;
import com.lancoo.znbkxx.net.URLConstant;
import com.lancoo.znbkxx.uis.PhoneMainActivity;

import java.math.BigDecimal;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import wangguolongTest.TestMainActivity;
import wangguolongTest.TestOneActivity;
import znbkBkfx.BkfxActivity;
import znbkBkfx.BkfxMainInforActivity;
import znbkBkfx.GetBkfxJson.BkfxPaperEntity;
import znbkBkfx.GetBkfxPaperResultJson.BkfxPaperResultEntity;
import znbkBkfx.GetBkfxPaperResultJson.GetRequest_BkfxPaperResultInterface;

public class BkfxPaperResultActivity extends BaseLongActivity {

    private LinearLayout mLlPaperResultInforLoading;
    private ScaleButton mSBtnBack;
    private LinearLayout mLlResultScore;
    private ScaleButton mSBtnDuration,mSBtnAverageScore,mSBtnHighestScore;
    private LinearLayout mLlPaperResultAnalysisItems;
    private BkfxPaperResultEntity bkfxPaperResultEntity;

    @Override
    protected int setLayout() {
        return R.layout.activity_paper_result;
    }

    @Override
    protected void initView() {
        mSBtnBack = findViewById(R.id.sbtn_back);
        mSBtnBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                Intent intent = new Intent();
                intent.setClass(BkfxPaperResultActivity.this, PhoneMainActivity.class);
                startActivity(intent);
            }
        });

        mLlResultScore = findViewById(R.id.ll_resultScore);
        mSBtnDuration = findViewById(R.id.sbtn_duration);
        mSBtnAverageScore = findViewById(R.id.sbtn_averageScore);
        mSBtnHighestScore = findViewById(R.id.sbtn_highestScore);

        mLlPaperResultAnalysisItems = findViewById(R.id.ll_paperResultAnalysisItems);

        mLlPaperResultInforLoading = findViewById(R.id.ll_paperResultInforLoading);
        bkfxPaperResultEntity = BkfxMainInforActivity.bkfxPaperResultEntity;
        if(bkfxPaperResultEntity==null){
            mLlPaperResultInforLoading.setVisibility(View.VISIBLE);
            requestBkfxPaperResult();
        }else {
            mLlPaperResultInforLoading.setVisibility(View.GONE);
            showTopPaperResultInfor();
            showQuesTypeAndItems();
        }
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        finish();
        Intent intent = new Intent();
        intent.setClass(BkfxPaperResultActivity.this, PhoneMainActivity.class);
        startActivity(intent);
    }

    private void showTopPaperResultInfor(){

        double Score  = bkfxPaperResultEntity.getScore();
        String strResultScore  = String.valueOf(Score);
        Log.e("showTopPaperResultInfor","================StrScore================="+strResultScore);
        if (strResultScore.contains(".")){

            String [] newStuScore = strResultScore.split("\\.");
            String front_stuScore = newStuScore[0];
            if(Integer.valueOf(front_stuScore)>=0 && Integer.valueOf(front_stuScore)<=9){
                drawStuScore(front_stuScore);
            }else if(Integer.valueOf(front_stuScore)>=10 && Integer.valueOf(front_stuScore)<=99){
                String str_front_stuScore_0 = front_stuScore.substring(0,1);
                drawStuScore(str_front_stuScore_0);
                String str_front_stuScore_1 = front_stuScore.substring(1,2);
                drawStuScore(str_front_stuScore_1);
            }else{
                String str_front_stuScore_0 = front_stuScore.substring(0,1);
                drawStuScore(str_front_stuScore_0);
                String str_front_stuScore_1 = front_stuScore.substring(1,2);
                drawStuScore(str_front_stuScore_1);
                String str_front_stuScore_2 = front_stuScore.substring(2,3);
                drawStuScore(str_front_stuScore_2);
            }
            String after_stuScore = newStuScore[1];
            if(Integer.valueOf(after_stuScore)>0){
                ImageView mIv_point = new ImageView(this);
                mIv_point.setImageResource(R.mipmap.result_score_point);
                LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
                //此处相当于布局文件中的Android:layout_gravity属性
                lp.gravity = Gravity.BOTTOM;
                mLlResultScore.addView(mIv_point,lp);

                ImageView mIv_5 = new ImageView(this);
                mIv_5.setImageResource(R.mipmap.result_score_5);
                mLlResultScore.addView(mIv_5);
            }

            ImageView mIv_conpany = new ImageView(this);
            mIv_conpany.setImageResource(R.mipmap.result_score_company);
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
            //此处相当于布局文件中的Android:layout_gravity属性
            lp.gravity = Gravity.BOTTOM;
            mLlResultScore.addView(mIv_conpany,lp);

        }

        double Duration = bkfxPaperResultEntity.getDuration();
        String Mins = LancooUtils.getMins((long)Duration);
        String Secs = LancooUtils.getSeconds((long)Duration);
        Log.e("==Duration==","================Mins================"+Mins);
        Log.e("==Duration==","================Secs================"+Secs);
        mSBtnDuration.setText(Html.fromHtml(getResources().
                getString(R.string.paper_result_durtion, Mins, Secs)));
        Double AverageScore = bkfxPaperResultEntity.getAverageScore();
        AverageScore = LancooUtils.round(AverageScore,1,BigDecimal.ROUND_DOWN);
        String strAverageScore = String.valueOf(LancooUtils.killlingDouble(AverageScore));
        mSBtnAverageScore.setText(Html.fromHtml(getResources().
                getString(R.string.paper_averageScore,strAverageScore)));
        Double HighestScore = bkfxPaperResultEntity.getHighestScore();
        HighestScore = LancooUtils.round(HighestScore,1,BigDecimal.ROUND_DOWN);
        String strHighestScore = String.valueOf(LancooUtils.killlingDouble(HighestScore));
        mSBtnHighestScore.setText(Html.fromHtml(getResources().
                getString(R.string.paper_highestScore,strHighestScore)));
    }

    private TextView[] mTvQuesIndexTypeScore;
    private RelativeLayout[] mRlQuesList;
    private void showQuesTypeAndItems() {
        WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics dm = new DisplayMetrics();
        wm.getDefaultDisplay().getMetrics(dm);
        int width = dm.widthPixels;         // 屏幕宽度（像素）
        int height = dm.heightPixels;       // 屏幕高度（像素）

        int SortIndex = 0;//小题个数
        int thisChildIndex = 0;
        int thisSubChildIndex = 0;

        int childListSize = bkfxPaperResultEntity.getPaperQues().size();
        mTvQuesIndexTypeScore = new TextView[childListSize];
        mRlQuesList = new RelativeLayout[childListSize];
        for (int i = 0; i < childListSize; i++) {

            mTvQuesIndexTypeScore[i] = new TextView(this);
            RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT ,ViewGroup.LayoutParams.WRAP_CONTENT);
            mTvQuesIndexTypeScore[i].setPadding(40,20,0,20);
            mTvQuesIndexTypeScore[i].setBackgroundColor(Color.parseColor("#e2eff4"));
            String GenreName = bkfxPaperResultEntity.getPaperQues().get(i).getGenreName();
            String TypeName = bkfxPaperResultEntity.getPaperQues().get(i).getTypeName();
            if(GenreName.equals("")){
                GenreName = TypeName;
            }
            Double EvalScore = bkfxPaperResultEntity.getPaperQues().get(i).getEvalScore();
            String strEvalScore = String.valueOf(LancooUtils.killlingDouble(EvalScore));
            Double TotalScore = bkfxPaperResultEntity.getPaperQues().get(i).getTotalScore();
            String strTotalScore = String.valueOf(LancooUtils.killlingDouble(TotalScore));
            if(EvalScore>=TotalScore*0.6){
                mTvQuesIndexTypeScore[i].setText(Html.fromHtml(getResources().
                        getString(R.string.ques_index_type_score_green, LancooUtils.numberToChinese(i + 1), GenreName, strEvalScore, strTotalScore)));
            }else {
                mTvQuesIndexTypeScore[i].setText(Html.fromHtml(getResources().
                        getString(R.string.ques_index_type_score_red, LancooUtils.numberToChinese(i + 1), GenreName, strEvalScore, strTotalScore)));
            }
            mLlPaperResultAnalysisItems.addView(mTvQuesIndexTypeScore[i],rl);

            mRlQuesList[i] = new RelativeLayout(this);
            mRlQuesList[i].setPadding(30, 30, 30, 30);

            int subChildListSize = 0;//小题个数
            String TypeNo = bkfxPaperResultEntity.getPaperQues().get(i).getTypeNo();
            int ChildPaperQuesSize = bkfxPaperResultEntity.getPaperQues().get(i).getQuesList().size();
            for(int p=0;p<ChildPaperQuesSize;p++){
                subChildListSize = subChildListSize + bkfxPaperResultEntity.getPaperQues().get(i).getQuesList().get(p).
                        getItemCount();
            }

            ScaleButton[] SBtn = new ScaleButton[subChildListSize];
            int k = -1;

            for (int j=0; j<subChildListSize; j++) {
                SBtn[j]=new ScaleButton(this);

                if(TypeNo.equals("N")||TypeNo.equals("Q")||TypeNo.equals("b")||
                        TypeNo.equals("U")||TypeNo.equals("S")||TypeNo.equals("m")){

                    SortIndex = SortIndex+1;//小题编号

                    int QuesList_PaperSize = bkfxPaperResultEntity.getQuesList().size();
                    for(int x=0;x<QuesList_PaperSize;x++){
                        int QuesList_ChildSize = bkfxPaperResultEntity.getQuesList().get(x).getChildList().get(0).
                                getSubChildList().get(0).getSubChildItem().size();
                        for (int y = 0; y < QuesList_ChildSize; y++) {

                            int QuesList_SortIndex = bkfxPaperResultEntity.getQuesList().get(x).getChildList().get(0).
                                    getSubChildList().get(0).getSubChildItem().get(y).getSortIndex();
                            if (SortIndex == QuesList_SortIndex) {
                                Log.e("==XY11==", "=======00===========XXX=====================" + x);
                                Log.e("==XY11==", "========00==========YYY=====================" + y);
                                thisChildIndex = x;
                                thisSubChildIndex = y;
                                final int finalThisChildIndex1 = thisChildIndex;
                                final int finalThisSubChildIndex1 = thisSubChildIndex;
                                SBtn[j].setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        Log.e("==XYXY===","=====iiii========"+ finalThisChildIndex1 +"=====jjjjj======"+ finalThisSubChildIndex1);
                                        BkfxPaperEntity bkfxPaperEntity = BkfxMainInforActivity.bkfxPaperEntity;
                                        bkfxPaperEntity.setFinishCount(finalThisChildIndex1);

                                        Intent intent = new Intent();
                                        intent.setClass(BkfxPaperResultActivity.this, BkfxActivity.class);
                                        startActivity(intent);
                                    }
                                });
                                break;
                            }
                        }

                    }

                }else if(TypeNo.equals("k")){
                    SortIndex = SortIndex+1;//小题编号

                    int QuesList_PaperSize = bkfxPaperResultEntity.getQuesList().size();
                    for(int x=0;x<QuesList_PaperSize;x++){

                        int QuesList_ChildSize = bkfxPaperResultEntity.getQuesList().get(x).getChildList().size();
                        Log.e("SortIndexAA","====================QuesList_ChildSize=================="+QuesList_ChildSize);
                        for(int y=0;y<QuesList_ChildSize;y++){

                            int QuesList_SortIndex_first = bkfxPaperResultEntity.getQuesList().get(x).getChildList().get(0).
                                    getSubChildList().get(0).getSubChildItem().get(0).getSortIndex();
                            int QuesList_SortIndex_last = bkfxPaperResultEntity.getQuesList().get(x).getChildList().get(y).
                                    getSubChildList().get(0).getSubChildItem().get(0).getSortIndex();

                            Log.e("==vvddff==", "========33333==========QuesList_SortIndex_first=====================" + QuesList_SortIndex_first);
                            Log.e("==vvddff==", "========33333==========QuesList_SortIndex_last=====================" + QuesList_SortIndex_last);

                            if(SortIndex>=QuesList_SortIndex_first && SortIndex<=QuesList_SortIndex_last){
                                Log.e("==SortIndexAA==", "========33333==========XXX=====================" + x);
                                Log.e("==SortIndexAA==", "=========33333=========YYY=====================" + y);
                                thisChildIndex = x;
                                thisSubChildIndex = y;
                                final int finalThisChildIndex1 = thisChildIndex;
                                final int finalThisSubChildIndex1 = thisSubChildIndex;
                                SBtn[j].setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        Log.e("==XYXY===","=====iiii========"+ finalThisChildIndex1 +"=====jjjjj======"+ finalThisSubChildIndex1);
                                        BkfxPaperEntity bkfxPaperEntity = BkfxMainInforActivity.bkfxPaperEntity;
                                        bkfxPaperEntity.setFinishCount(finalThisChildIndex1);

                                        Intent intent = new Intent();
                                        intent.setClass(BkfxPaperResultActivity.this, BkfxActivity.class);
                                        startActivity(intent);
                                    }
                                });
                                break;
                            }
                        }
                    }
                }else {
                    SortIndex = SortIndex+1;//小题编号

                    int QuesList_PaperSize = bkfxPaperResultEntity.getQuesList().size();
                    for(int x=0;x<QuesList_PaperSize;x++){

                        int QuesList_ChildSize = bkfxPaperResultEntity.getQuesList().get(x).getChildList().size();
                        for(int y=0;y<QuesList_ChildSize;y++){

                            int QuesList_SortIndex = bkfxPaperResultEntity.getQuesList().get(x).getChildList().get(y).
                                    getSubChildList().get(0).getSubChildItem().get(0).getSortIndex();
                            if(SortIndex==QuesList_SortIndex){
                                Log.e("==XY22==", "========33333==========XXX=====================" + x);
                                Log.e("==XY22==", "=========33333=========YYY=====================" + y);
                                thisChildIndex = x;
                                thisSubChildIndex = y;
                                final int finalThisChildIndex1 = thisChildIndex;
                                final int finalThisSubChildIndex1 = thisSubChildIndex;
                                SBtn[j].setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        Log.e("==XYXY===","=====iiii========"+ finalThisChildIndex1 +"=====jjjjj======"+ finalThisSubChildIndex1);
                                        BkfxPaperEntity bkfxPaperEntity = BkfxMainInforActivity.bkfxPaperEntity;
                                        bkfxPaperEntity.setFinishCount(finalThisChildIndex1);

                                        Intent intent = new Intent();
                                        intent.setClass(BkfxPaperResultActivity.this, BkfxActivity.class);
                                        startActivity(intent);
                                    }
                                });
                                break;
                            }
                        }

                    }

                }
                SBtn[j].setText(String.valueOf(SortIndex));
                SBtn[j].setTextSize(12);
                SBtn[j].setGravity(Gravity.CENTER);
                RelativeLayout.LayoutParams btParams = new RelativeLayout.LayoutParams ((width)/8,(width)/8);

                int SubmitState = bkfxPaperResultEntity.getPaperAnswer().get(thisChildIndex).getSubmitState();
                String StuAnswer = "";
                double ScoreRate = 0;
                String TypeNoB = bkfxPaperResultEntity.getQuesList().get(thisChildIndex).getTypeInfo().getTypeNo();
                String GenreNameB = bkfxPaperResultEntity.getQuesList().get(thisChildIndex).getGenreInfo().getGenreName();
                if((TypeNoB.equals("N")&&!GenreNameB.equals("选词填空"))||TypeNoB.equals("Q")||TypeNoB.equals("b")||TypeNoB.equals("U")||TypeNoB.equals("S")||TypeNoB.equals("m")){
                    StuAnswer  = bkfxPaperResultEntity.getPaperAnswer().get(thisChildIndex).getChildList().get(0).getSubChildList().
                            get(0).getSubChildItem().get(thisSubChildIndex).getStuAnswer();
                    ScoreRate = bkfxPaperResultEntity.getPaperAnswer().get(thisChildIndex).getChildList().get(0).getSubChildList().
                            get(0).getSubChildItem().get(thisSubChildIndex).getScoreRate();
                }else {
                    StuAnswer  = bkfxPaperResultEntity.getPaperAnswer().get(thisChildIndex).getChildList().get(thisSubChildIndex).getSubChildList().
                            get(0).getSubChildItem().get(0).getStuAnswer();
                    ScoreRate = bkfxPaperResultEntity.getPaperAnswer().get(thisChildIndex).getChildList().get(thisSubChildIndex).getSubChildList().
                            get(0).getSubChildItem().get(0).getScoreRate();
                    if(thisChildIndex==24){
                        Log.e("ABCCBA","=================thisSubChildIndex============"+thisSubChildIndex);
                        Log.e("ABCCBA","=================ScoreRate============"+ScoreRate);
                    }
                }

                if(SubmitState!=2){
                    if(StuAnswer.equals("")){
                        SBtn[j].setBackgroundResource(R.mipmap.white);
                        SBtn[j].setTextColor(Color.parseColor("#000000"));
                    }else{
                        SBtn[j].setBackgroundResource(R.mipmap.blue);
                        SBtn[j].setTextColor(Color.parseColor("#ffffff"));
                    }
                }else {
                    if(TypeNo.equals("f")){
                        int State = bkfxPaperResultEntity.getPaperAnswer().get(thisChildIndex).getState();
                        if(State==2){
                            if (ScoreRate >= 0.6) {
                                SBtn[j].setBackgroundResource(R.mipmap.green);
                                SBtn[j].setTextColor(Color.parseColor("#ffffff"));
                            } else {
                                SBtn[j].setBackgroundResource(R.mipmap.red);
                                SBtn[j].setTextColor(Color.parseColor("#ffffff"));
                            }
                        }else{
                            SBtn[j].setBackgroundResource(R.mipmap.blue);
                            SBtn[j].setTextColor(Color.parseColor("#ffffff"));
                        }
                    }else {
                        if (ScoreRate >= 0.6) {
                            SBtn[j].setBackgroundResource(R.mipmap.green);
                            SBtn[j].setTextColor(Color.parseColor("#ffffff"));
                        } else {
                            SBtn[j].setBackgroundResource(R.mipmap.red);
                            SBtn[j].setTextColor(Color.parseColor("#ffffff"));
                        }
                    }
                }

                if (j%5 == 0) {
                    k++;
                }
                btParams.setMargins(20,20,20,20);
                btParams.leftMargin = ((width)/7+50)*(j%5); //横坐标定位
                btParams.topMargin = ((width)/7)*k+20; //纵坐标定位
                mRlQuesList[i].addView(SBtn[j],btParams); //将按钮放入layout组件
            }
            mLlPaperResultAnalysisItems.addView(mRlQuesList[i]);
        }
    }


    public void requestBkfxPaperResult() {
        String BASE_URL = URLConstant.BASE_URL;
        //步骤4:创建Retrofit对象
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL) // 设置 网络请求 Url
                .addConverterFactory(GsonConverterFactory.create()) //设置使用Gson解析(记得加入依赖)
                .build();

        // 步骤5:创建 网络请求接口 的实例
        final GetRequest_BkfxPaperResultInterface request = retrofit.create(GetRequest_BkfxPaperResultInterface.class);

        //对 发送请求 进行封装
        Log.e("==显示BBBBB==","============UserInfoBean.SchoolID==============="+ UserInfoBean.SchoolID);
        Log.e("==显示BBBBB==","============UserInfoBean.SubjectID================"+ UserInfoBean.SubjectID);
        Log.e("==显示BBBBB==","============UserInfoBean.GlobalGrade==============="+ UserInfoBean.GlobalGrade);
        Log.e("==显示BBBBB==","============UserInfoBean.CourseClassID================"+ UserInfoBean.CourseClassID);
        Log.e("==显示BBBBB==","============PhoneMainActivity.getPaperId()================"+ PhoneMainActivity.getPaperId());
        Log.e("==显示BBBBB==","============UserInfoBean.StuId================"+ UserInfoBean.StuId);
        Call<BkfxPaperResultEntity> call = request.getPaperAnalysis(UserInfoBean.Key,UserInfoBean.CourseClassID,UserInfoBean.GlobalGrade,
                PhoneMainActivity.getPaperId(),true,true,UserInfoBean.SchoolID,1,
                UserInfoBean.StuId,UserInfoBean.SubjectID);

        Log.e("===onResponse==","=====call========="+call);

        //步骤6:发送网络请求(异步)
        call.enqueue(new Callback<BkfxPaperResultEntity>() {
            //请求成功时候的回调
            @Override
            public void onResponse(Call<BkfxPaperResultEntity> call, Response<BkfxPaperResultEntity> response) {
                //请求处理,输出结果
                bkfxPaperResultEntity = response.body();
                Log.e("===onResponse==","=====response========="+response);
                mLlPaperResultInforLoading.setVisibility(View.GONE);

                showTopPaperResultInfor();
                showQuesTypeAndItems();
            }

            //请求失败时候的回调
            @Override
            public void onFailure(Call<BkfxPaperResultEntity> call, Throwable throwable) {
                System.out.println("连接失败");
                mLlPaperResultInforLoading.setVisibility(View.GONE);
            }
        });
    }

    private void drawStuScore(String score){
        if(score.equals("0")){
            ImageView mIv_0 = new ImageView(this);
            mIv_0.setImageResource(R.mipmap.result_score_0);
            mLlResultScore.addView(mIv_0);
        }else if(score.equals("1")){
            ImageView mIv_1 = new ImageView(this);
            mIv_1.setImageResource(R.mipmap.result_score_1);
            mLlResultScore.addView(mIv_1);
        }else if(score.equals("2")){
            ImageView mIv_2 = new ImageView(this);
            mIv_2.setImageResource(R.mipmap.result_score_2);
            mLlResultScore.addView(mIv_2);
        }else if(score.equals("3")){
            ImageView mIv_3 = new ImageView(this);
            mIv_3.setImageResource(R.mipmap.result_score_3);
            mLlResultScore.addView(mIv_3);
        }else if(score.equals("4")){
            ImageView mIv_4 = new ImageView(this);
            mIv_4.setImageResource(R.mipmap.result_score_4);
            mLlResultScore.addView(mIv_4);
        }else if(score.equals("5")){
            ImageView mIv_5 = new ImageView(this);
            mIv_5.setImageResource(R.mipmap.result_score_5);
            mLlResultScore.addView(mIv_5);
        }else if(score.equals("6")){
            ImageView mIv_6 = new ImageView(this);
            mIv_6.setImageResource(R.mipmap.result_score_6);
            mLlResultScore.addView(mIv_6);
        }else if(score.equals("7")){
            ImageView mIv_7 = new ImageView(this);
            mIv_7.setImageResource(R.mipmap.result_score_7);
            mLlResultScore.addView(mIv_7);
        }else if(score.equals("8")){
            ImageView mIv_8 = new ImageView(this);
            mIv_8.setImageResource(R.mipmap.result_score_8);
            mLlResultScore.addView(mIv_8);
        }else if(score.equals("9")){
            ImageView mIv_9 = new ImageView(this);
            mIv_9.setImageResource(R.mipmap.result_score_9);
            mLlResultScore.addView(mIv_9);
        }
    }


}